package com.llbnk.springcoding.controller;


import com.llbnk.springcoding.pojo.User;
import com.llbnk.springcoding.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;



    @GetMapping("/test/get/user/by/id")
    public User testUserInfoById(@RequestParam("userId") Long userId) {
        return userService.testUserInfoById(userId);
    }


    /**
     * 一下为数据库迁移接口
     * ===============================================================================
     * ===============================================================================
     */
    @GetMapping("/test/get/userinfo")
    public User testUserById(@RequestParam("userId") Long userId) {
        return userService.testUserById(userId);
    }


    @PostMapping("/test/add/user")
    public String testAddNewUser(@RequestBody User user) {
        return userService.testAddNewUser(user);
    }
}
